package org.chen.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.chen.domain.entity.ArticleTranslation;

import java.util.List;

@Mapper
public interface ArticleTranslationMapper extends BaseMapper<ArticleTranslation> {

    /**
     * 根据文章ID和语言查询翻译
     */
    @Select("SELECT * FROM article_translation WHERE article_id = #{articleId} AND language = #{language} LIMIT 1")
    ArticleTranslation selectByArticleAndLanguage(@Param("articleId") String articleId, @Param("language") String language);

    /**
     * 根据文章ID查询所有翻译
     */
    @Select("SELECT * FROM article_translation WHERE article_id = #{articleId}")
    List<ArticleTranslation> selectByArticleId(@Param("articleId") String articleId);
}
